package gitee.derumin.railway_accelerator.things;

public class RAConfig {
    public double maxSpeed;
    public double coalCalorificValue;
    public double minSpeedCauseDamage;
    public double standardDamage;
    public double maxDamageSpeed;

    public RAConfig(){
        this.maxSpeed = 64d;
        this.coalCalorificValue = 300d;
        this.minSpeedCauseDamage = 10d;
        this.standardDamage = 100;
        this.maxDamageSpeed = this.maxSpeed;
    }

    public double getMaxPower(){
        return 0.024748737341529d *this.maxSpeed;
    }

    public float getDamage(double vr, double stm){
        if (this.minSpeedCauseDamage < 0d){
            this.minSpeedCauseDamage = 0d;
        }
        if (this.maxDamageSpeed <= this.minSpeedCauseDamage || this.standardDamage <= 0d || vr <= this.minSpeedCauseDamage){
            return 0f;
        }
        double d = stm;
        if (vr < this.maxDamageSpeed) {
            d *= (vr -this.minSpeedCauseDamage) / (this.maxDamageSpeed -this.minSpeedCauseDamage);
        }
        d *= this.standardDamage;
        return (float) d;
    }
}
